﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Common;

namespace DVT.Controllers
{
    public class OnlineEnrolController : Controller
    {
        //
        // GET: /OnlineEnrol/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Enrol(string qqcontact,string phone,string uname,string content)
        {
            MailHelper mailHelper = new MailHelper();
            string[] tos = new string[]
                               {
                                   "395802201@qq.com",
                                   "761050769@qq.com"
                               };
            StringBuilder sb = new StringBuilder();
            sb.AppendLine(uname + "同学通过招生网向您发来了咨询消息,内容如下");
            sb.Append(content);
            sb.AppendLine("他的联系方式为：QQ" + qqcontact + "电话" + phone);
            string msg = "";
            try
            {
                mailHelper.SendMail("smtp.163.com", 25, "china_fesco@163.com", "miaozhuang", "china_fesco@163.com", tos, null,
                               uname+"同学通过招生网向您发来了咨询消息",sb.ToString());
                msg = "发送成功！稍后会有我们老师联系你！";
            }
            catch (Exception ex)
            {
                msg = "发送失败";
                
            }
            ViewBag.MSG = msg;
            return View();
        }
    }
}
